<template>
  <div class="my-select">
    <!-- 这里用的是form，原本form就是最外层，传进来接收每个form表单的参数的 -->
    <el-select v-model="form[attr.prop]" @change="selectChanged">
      <el-option v-for="item in optionArr" :key="item.value" :label="item.label" :value="item.value"></el-option>
    </el-select>
  </div>
</template>

<script>
export default {
  name: "MySelect",
  props: {
    attr: {
      type: Object,
      default: () => { }
    },
    form: {
      type: Object,
      default: () => { }
    },
    optionArr: {
      type: Array,
      default: () => []
    },
  },
  data() {
    return {

    }
  },
  methods: {
    selectChanged(val) {
      console.log('el-select', val);
    }
  }
};
</script>
<style scoped lang="scss"></style>